$(document).ready(function(){

   $("#validate").validate({
	
                      errorClass:'showerror_li',
	});
	
	$('.SUBJECT_CODE_one').each(function() {
        $(this).rules('add', {
            required: true,
			number: true,
            messages: {
                required:  "",
				number:  "" 
            }
        });
    });
	
	$('.SUBJECT_CODE_two').each(function() {
        $(this).rules('add', {
            required: true,
			number: true,
            messages: {
                required:  "",
				number:  "" 
            }
        });
    });
	
	$('.SUBJECT_NAME_THAI').each(function() {
        $(this).rules('add', {
            required: true,
            messages: {
                required:  "<li>กรอกข้อมูล</li>", 
            }
        });
    });
	$('.LECTURE_HOUR').each(function() {
        $(this).rules('add', {
            required: true,
			number: true,
			maxlength:1,
            messages: {
                required:  "",
				number:  "",
				maxlength:  "", 
            }
        });
    });
	$('.LAB_HOUR').each(function() {
        $(this).rules('add', {
            required: true,
			number: true,
			maxlength:1,
           messages: {
                required:  "",
				number:  "",
				maxlength:  "",  
            }
        });
    });
	$('.SELF_HOUR').each(function() {
        $(this).rules('add', {
            required: true,
			number: true,
			maxlength:1,
            messages: {
                required:  "",
				number:  "",
				maxlength:  "",  
            }
        });
    });
	
	
	$('.SUBJECT_NAME_ENG').each(function() {
        $(this).rules('add', {
            required: true,
            messages: {
                required:  "<li>กรอกข้อมูล</li>", 
            }
        });
    });
	
	$('.SHORT_NAME_ENG').each(function() {
        $(this).rules('add', {
            required: true,
            messages: {
                required:  "<li>กรอกข้อมูล</li>", 
            }
        });
    });
	

	
	$('.SUBJECT_TYPE_ID').each(function() {
        $(this).rules('add', {
            required: true,
            messages: {
                required:  "<li>เลือกข้อมูล</li>", 
            }
        });
    });
	
	
	
	
	/*
	rules: {   
   		SUBJECT_CODE:{    
			required : true             
			},
		SUBJECT_NAME_THAI:{    
			required : true             
			},
		SUBJECT_NAME_ENG:{    
			required : true             
			},
		SHORT_NAME_ENG:{    
			required : true             
			},
		LECTURE_HOUR:{    
			required : true, 
			number : true            
			},
		LAB_HOUR:{    
			required : true,
			number : true              
			},
		SELF_HOUR:{    
			required : true,
			number : true              
			},
		SUBJECT_TYPE_ID:{    
			required : true             
			}                   
		 },   
		          
	 messages: {          
		 SUBJECT_CODE : { 
			 required :  "<li> ??????????????? </li>"
			}, 
		SUBJECT_NAME_THAI:{    
			required : "<li> ??????????????? </li>"            
			},
		SUBJECT_NAME_ENG:{    
			required : "<li> ??????????????? </li>"             
			},
		SHORT_NAME_ENG:{    
			required : "<li> ??????????????? </li>"             
			},
		LECTURE_HOUR:{    
			required : "<li> ??????????????? </li>", 
			number : "<li> ???????????????????????????? </li>"            
			},
		LAB_HOUR:{    
			required : "<li> ??????????????? </li>",
			number : "<li> ???????????????????????????? </li>"              
			},
		SELF_HOUR:{    
			required : "<li> ??????????????? </li>",
			number : "<li> ???????????????????????????? </li>"              
			},
		SUBJECT_TYPE_ID:{    
			required : "<li> ??????????????? </li>"             
			}           	                 
		}      

		*/
    
});
$(document).ready(function(){

   $("#validate2").validate({
	
                      errorClass:'showerror',
	});
$('.filesubject').each(function() {
        $(this).rules('add', {
            required: true,
            messages: {
                required:  "<li> กรุณาเลือกไฟล์ที่จะอัพโหลด </li>", 
            }
        });
    });
});
